package xy.rocketmq.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import xy.rocketmq.service.MQProducerService;

import javax.annotation.Resource;

@RestController
public class MessageController {
    @Resource
    MQProducerService mqProducerService;

    @RequestMapping(value = "/send",method = RequestMethod.GET)
    public String  send(String s) {
        mqProducerService.send(s);
        return "添加成功";
    }


    @RequestMapping(value = "/sendTagMsg",method = RequestMethod.GET)
    public String  sendTagMsg(String s) {
        mqProducerService.sendTagMsg(s);
        return "添加成功";
    }


    @RequestMapping(value = "/sendSyncMsg",method = RequestMethod.GET)
    public String  sendSyncMsg(String s) {
        mqProducerService.sendSyncMsg(s);
        return "添加成功";
    }

    @RequestMapping(value = "/sendAsyncMsg",method = RequestMethod.GET)
    public String  sendAsyncMsg(String s) {
        mqProducerService.sendAsyncMsg(s);
        return "添加成功";
    }


    @RequestMapping(value = "/sendDelayMsg",method = RequestMethod.GET)
    public String  sendDelayMsg(String s) {
        mqProducerService.sendDelayMsg(s,3);
        return "添加成功";
    }
}
